<?php

namespace app\common\model;

use think\Model;

class Users extends Model
{
    //
    public function checkLogin($data)
    {
        $res = $this->where('username',$data['username'])->find();
        if(!$res){
            return false;
        }
        //判断密码是否正确
        $pass = md5($data['password']);
        if($pass !== $res['password']){
            return false;
        }
        session('admin.user',$res);
        return true;
    }
}
